package com.nuonuo.refresh.config;

import com.nuonuo.middleware.drs.client.annotation.DrsValue;
import com.nuonuo.middleware.drs.spring.context.annotation.DrsBeanRefresh;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;


/**
 * @author duan
 * @version 1.0
 * @date 2023/1/20 15:56
 */
@Component
@DrsBeanRefresh
public class TestListener implements InitializingBean, DisposableBean {

    @DrsValue("${my.username:dd}")
    private String username;

    @PostConstruct
    public void init() {
        System.out.println("TestListener init......");
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("TestListener afterPropertiesSet......");
        System.out.println(username);
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("TestListener destroy......");
    }
}
